package com.atung.merchant.controller;

import cn.hutool.system.UserInfo;
import com.atung.merchant.result.ApiResult;
import com.atung.merchant.service.HomeService;
import com.atung.merchant.vo.MealMenuTypeResponse;
import com.atung.merchant.vo.ResponseMerchantUser;
import com.atung.merchant.vo.query.QueryRoomInfoRequest;
import com.atung.merchant.vo.RoomInfoResponse;
import com.atung.merchant.vo.SettlementListResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Administrator
 */
@RestController
@RequestMapping("/api/home")
@Api(tags = "首页管理")
public class HomeController {

    @Resource
    private HomeService homeService;

    @PostMapping("/user/info")
    @ApiOperation("首页获取用户信息")
    //获取用户信息
    public ApiResult<ResponseMerchantUser> getUserInfo() {
        ResponseMerchantUser responseMerchantUser=homeService.getUserInfoService();
        return ApiResult.ok(responseMerchantUser);
    }
    @PostMapping("/settlement/list")
    @ApiOperation("首页获取订单信息")
    public ApiResult<List<SettlementListResponse>> getSettlementList() {
        List<SettlementListResponse> settlementListResponseList = homeService.getSettlementListService();
        return ApiResult.ok(settlementListResponseList);
    }

    @PostMapping("/settlement/menu/type")
    @ApiOperation("首页获取订单信息")
    public ApiResult<List<MealMenuTypeResponse>> getSettlementMenuType() {
        List<MealMenuTypeResponse> settlementListResponseList = homeService.getSettlementMenuTypeService();
        return ApiResult.ok(settlementListResponseList);
    }

    @PostMapping("/room/list")
    @ApiOperation("首页获取房间信息")
    public ApiResult<RoomInfoResponse> getRoomList(@RequestBody QueryRoomInfoRequest queryRoomInfoRequest) {
        RoomInfoResponse roomInfoResponse = homeService.getRoomListService(queryRoomInfoRequest);
        return ApiResult.ok(roomInfoResponse);
    }

}
